<?php


namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class CartRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'partition_table_record_id' => 'required',
            'detail_list' => 'required|array',
            'detail_list.*.product_online_id' => 'required',
            'detail_list.*.productspec_online_id' => 'required',
            'detail_list.*.qty' => 'required|integer',
            'detail_list.*.op' => ['required',Rule::in(['init','add','del'])],
        ];
    }

}